﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lidgren.Network;
using Lidgren.Network.Xna;
using Microsoft.Xna.Framework;
using SharedLib.Engine;

namespace SharedLib.Network.Server
{
    public class ServerPlayer : Creature
    {
        public string Ip = "";
        public NetConnection NetConn;


        public ServerPlayer(NetConnection netcon)
        {
            Type = Engine.EntityType.Player;
            NetConn = netcon;
            ID = IDManager.getNewID(); //netcon.RemoteUniqueIdentifier;
            Ip = netcon.RemoteEndpoint.Address.ToString();
        }

        public override void WriteData(NetOutgoingMessage outmsg)
        {
            base.WriteData(outmsg);
            outmsg.Write(this.ID);
            outmsg.Write(this.Name);
            outmsg.Write(this.Position);
            outmsg.Write(this.Rotation);
            outmsg.Write(this.HP);
            outmsg.Write(this.HPMAX);
            outmsg.Write(this.Mana);
            outmsg.Write(this.ManaMAX);
        }
    }
}
